package br.indt.framework.scheduler;

/**
 * SchedulerTaskFacade is a singleton facade class to a Scheduler instance
 *
 * @author sifilho
 */
public class SchedulerTaskFacade {

    private static SchedulerTaskFacade instance = null;
    private Scheduler scheduler;

    private SchedulerTaskFacade() {
        scheduler = new Scheduler();
    }

    public static SchedulerTaskFacade getInstance() {
        if (instance == null) {
            instance = new SchedulerTaskFacade();
        }
        return instance;
    }

    public void add(Task t, int delaySeconds) {
        scheduler.add(t, delaySeconds, false);
    }

    public void add(Task t, int delaySeconds, boolean periodic) {
        scheduler.add(t, delaySeconds, periodic);
    }

    public void remove(Task t) {
        scheduler.remove(t);
    }

    public void removeAll() {
        scheduler.removeAll();
    }

    public boolean isEmpty() {
        return scheduler.isEmpty();
    }
}